package k3_IO.p2_fileStream.demo01;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class DataStream {

    public static void dataOutputStream() throws Exception{

        DataOutputStream dos = new DataOutputStream(new FileOutputStream("E://data.txt"));

        dos.writeUTF("hello");

        dos.close();

    }


    public static void dataInputStream() throws Exception{
        DataInputStream dis = new DataInputStream(new FileInputStream("E://data.txt"));
        System.out.println(dis.readUTF());
        dis.close();
    }


    public static void main(String[] args) throws Exception {

        DataStream.dataOutputStream();
        DataStream.dataInputStream();


    }
}
